package descentFly.data {
	import UIFree.uif_transition;
	
	import UIUtils.uif_utilA;
	
	import descentFly.away3D4.Background.df_bgSky;
	import descentFly.away3D4.Background.df_bgSpace;
	import descentFly.away3D4.Generator.df_doorGenerator;
	import descentFly.away3D4.Generator.df_doors;
	import descentFly.away3D4.Generator.df_medicGenerator;
	import descentFly.away3D4.Generator.df_monsterGenerator;
	import descentFly.away3D4.Generator.df_pointsGenerator;
	import descentFly.away3D4.Generator.df_tportGenerator;
	import descentFly.away3D4.action.df_action;
	import descentFly.away3D4.action.df_actionRotate;
	import descentFly.away3D4.action.df_dir;
	import descentFly.away3D4.action.df_moving;
	import descentFly.away3D4.chips.df_chip3DS;
	import descentFly.away3D4.chips.df_chipAway;
	import descentFly.away3D4.chips.df_chipDummy;
	import descentFly.away3D4.chips.df_chipModel;
	import descentFly.away3D4.chips.df_monster;
	import descentFly.away3D4.controller.df_doorAway;
	import descentFly.away3D4.controller.df_robot;
	import descentFly.away3D4.controller.df_robotAway;
	import descentFly.away3D4.df_awaySpace;
	import descentFly.away3D4.doors.df_door;
	import descentFly.away3D4.doors.df_door3DS;
	import descentFly.away3D4.doors.df_rotateDoor;
	import descentFly.away3D4.element.Extends.df_ammoController;
	import descentFly.away3D4.element.Extends.df_controller;
	import descentFly.away3D4.element.Extends.df_distanceController;
	import descentFly.away3D4.element.Extends.df_medicineController;
	import descentFly.away3D4.element.Extends.df_teleportController;
	import descentFly.away3D4.element.Extends.df_tportLevelCtrl;
	import descentFly.away3D4.element.df_element3DS;
	import descentFly.away3D4.element.df_rollElem;
	import descentFly.away3D4.exits.df_baseExit;
	import descentFly.away3D4.material.df_UVAnimMaterial;
	import descentFly.away3D4.net.controller.df_netController;
	import descentFly.away3D4.net.df_netChip;
	import descentFly.away3D4.net.df_netSupport;
	import descentFly.controller.FlyController;
	import descentFly.controller.df_robotController;
	import descentFly.controller.myFlyController;
	import descentFly.server.df_servers;
	import descentFly.view.df_view;
	import descentFly.weaponts.df_pulseWeapont;
	
	import flash.geom.Vector3D;
	
	public class df_smallLevels {
		public static const DEFAULTLEVELID: int = 1;
		public static const medicExtend: Object = {
			Class	: df_pointsGenerator,
			options	: {
				period		: 10000,
				timerName	: 'medicine',
				parse_event	: 'PARSE_MEDIC',
				element		: {
					Class	: df_rollElem,
					options	: {
						URL		: 'models/medicine/box.3DS',
						Extends	: {
							controller: {
								Class	: df_medicineController,
								options	: {
									medicalPercent: 0.2,
									sounds	: {
										init	: {
											url		: '/sound/points/medi01.mp3',
											volume	: 0.6
										},
										pickUp	: {
											url		: '/sound/points/med01.mp3',
											volume	: 1
										}
									}
								}
							}
						}
					}
				}
			}
		};
		
		public static const ammoExtend2: Object = {
			Class	: df_pointsGenerator,
			options	: {
				period		: 10000,
				timerName	: 'ammo2',
				parse_event	: 'PARSE_AMMO2',
				element		: {
					Class	: df_rollElem,
					options	: {
						URL		: 'models/points/ammo/AMMO02.3DS',
						Extends	: {
							controller: {
								Class	: df_ammoController,
								options	: {
									count			: 50,
									weapontID		: 2,
									sounds	: {
										init	: {
											url		: '/sound/points/medi01.mp3',
											volume	: 0.6
										},
										pickUp	: {
											url		: '/sound/points/med01.mp3',
											volume	: 1
										}
									}
								}
							}
						}
					}
				}
			}
		};

		public static const ammoExtend3: Object = {
			Class	: df_pointsGenerator,
			options	: {
				period		: 10000,
				timerName	: 'ammo3',
				parse_event	: 'PARSE_AMMUN',
				element		: {
					Class	: df_rollElem,
					options	: {
						URL		: 'models/points/ammo/AMMO03.3DS',
						Extends	: {
							controller: {
								Class	: df_ammoController,
								options	: {
									count			: 50,
									weapontID		: 3,
									sounds	: {
										init	: {
											url		: '/sound/points/medi01.mp3',
											volume	: 0.6
										},
										pickUp	: {
											url		: '/sound/points/med01.mp3',
											volume	: 1
										}
									}
								}
							}
						}
					}
				}
			}
		};
		
		public static const tportExtend: Object = {
			Class: df_tportGenerator,
			options: {
				parse_event: 'PARSE_TPORT',
				element: {
					Class	: df_element3DS,
					options	: {
						URL					: 'models/teleports/t01.3DS',
						animElementIndex	: 1,
						material	: {
							Class	: df_UVAnimMaterial,
							options	: {
								URL			: 'textures/tex01.png',
								transparent	: true
							}
						},
						Extends	: {
							controller: {
								Class	: df_teleportController,
								options	: {
									nearestScale: 0.3,
									group		: 'goto',
									sounds		: {
										nearest: {
											url		: 'sound/door/open01.mp3',
											volume	: 0.8
										}
									}
								}
							}
						}
					}
				}
			}
		}
		
		public static const tportExtendLevel: Object = uif_utilA.union(tportExtend, {
			options: {
				element: {
					options	: {
						Extends	: {
							controller: {
								options	: {
									nextLevel	: true
								}
							}
						}
					}
				}
			}
		});
			
/*		private static const monsterExtend: Object = {
			Class	: df_monsterGenerator,
			parse_event	: 'PARSE_MONST',
			options	: {
				monsterTmpl	: df_monsters.list[0],
				maxMonsters	: 4,
				periodMLS	: 20000							
			}
		};*/
		
		public static const MNSL01: Object = {
			Class		: df_monster,     
			options		: {
				url			: 'models/chip_01.3DS',
				live		: 5,
				bonus		: 1,
				attackable	: true,
				controller	: {
					Class	: df_robot,
					options	: {
						dangerousDistanceDec	: 0.2,
						pathID					: 'MNS',
						sounds: {
							init	: {
								url		: 'sound/chip/init03.mp3',
								volume	: 1
							},
							atack	: {
								url		: 'sound/chip/atack01.mp3',
								volume	: 1
							}
						}
					}
				},
				defaultWeapont	: 1,
				weaponts		: df_weaponts.fromRobot,
					maxSpeed	: 6,
					pathSpeed	: 6,
					modelData	: {
						Actions: [
							{
								name	: df_chipModel.WEAPONT_ACTIVATE_NAME,
								Class	: df_dir,
								objects	: 'wpRight,wpLeft',
								dir		: new Vector3D(0, 0, 20),
								center	: new Vector3D()
							},{
								name	: df_chipModel.WEAPONT_ACTIVATE_NAME,
								Class	: df_dir,
								objects	: 'flap_1,flap_2',
								dir		: new Vector3D(0, 0, 3),
								center	: new Vector3D()
							}
						]
					}
			}				
		};
		
		public static const MNSL02: Object = {
			Class		: df_monster,     
			options		: {
				url			: 'models/monsters/04/MD.3DS',
				live		: 15,
				bonus		: 3,
				attackable	: true,
				controller	: {
					Class	: df_robot,
					options	: {
						dangerousDistanceDec: 0.5,
						pathID	: "GIG",
						sounds: {
							init	: {
								url		: 'sound/chip/init03.mp3',
								volume	: 1
							},
							atack	: {
								url		: 'sound/chip/atack01.mp3',
								volume	: 1
							}
						}
					}
				},
				defaultWeapont	: 2,
				weaponts		: df_weaponts.fromRobot,
					maxSpeed		: 6,
					pathSpeed		: 4,
					modelData		: {
						Actions: [
							{
								name		: df_chipModel.WEAPONT_ACTIVATE_NAME,
								Class		: df_actionRotate,
								objects		: '_el01,_el02,_el03,_el04',
								roll		: new Vector3D(30, 30, 0)
							}
						]
					}
			}				
		}
		
		public static const monsterExtend: Object = {
			Class		: df_monsterGenerator,
			options		: {
				period		: 15000,
				parse_event	: 'PARSE_MONST',
				maxMonsters	: 3,
				element		: MNSL01
			}
		};
		
		public static const monsterExtend2: Object = {
			Class		: df_monsterGenerator,
			options		: {
				period		: 12000,
				parse_event	: 'PARSE_GIGAM',
				maxMonsters	: 1,
				totalCount	: 3,
				totalEvent	: "GIGATOTAL",
				element		: MNSL02
			}
		};
		
		public static const doorsGenerator: Object = {
			Class	: df_doorGenerator,
			options	: {
				doorTmpl: {
					Class	: df_door3DS,
					options	: {
						url			: 'models/door01.3DS',
						nearest		: 150,
						deathless	: true,
						controller	: {
							Class	: df_doorAway,
							options	: {
								sounds	: {
									open: {
										url: 'sound/door/open01.mp3',
										volume: 1
									},
									close: {
										url: 'sound/door/close01.mp3',
										volume: 1
									}
								}								
							}
						},
						modelData	: {
							Actions: [
								{
									name	: df_door.ACTION_OPEN_DOOR,
									Class	: df_actionRotate,
									roll	: new Vector3D(0, -45, 0)
								}
							]
						}
					}
				}							
			}
		}
			
		public static const MONBEE: Object = {
			Class		: df_monster,     
			options		: {
				url			: 'models/monsters/05/MD.3DS',
				live		: 5,
				bonus		: 3,
				attackable	: true,
				controller	: {
					Class	: df_robot,
					options	: {
						dangerousDistanceDec: 0.5,
						dangerAction		: 'SWING',
						pathID				: 'MNB',
						sounds: {
							init	: {
								url		: 'sound/chip/init03.mp3',
								volume	: 1
							},
							atack	: {
								url		: 'sound/chip/atack01.mp3',
								volume	: 1
							}
						}
					}
				},
				maxSpeed		: 6,
				pathSpeed		: 4,
				modelData		: {
					Actions: [
						{
							name		: 're1',
							cycle		: true,
							duration	: 3000,
							Class		: df_actionRotate,
							objects		: 's01',
							roll		: new Vector3D(0, 360, 0)
						},{
							name		: 're2',
							cycle		: true,
							duration	: 3000,
							Class		: df_actionRotate,
							objects		: 's02',
							roll		: new Vector3D(0, -360, 0)
						},{
							name		: 'SWING',
							duration	: 1000,
							Class		: df_actionRotate,
							objects		: 'h01,h02',
							transition	: uif_transition.vibration(),
							roll		: new Vector3D(0, -45, 0)
						}
					]
				}
			}
		};
		
		public static const defExplodes: Array = df_explodes.list;
		
		public static const lports: Object = {
			Class: df_tportGenerator,
			options: {
				parse_event: "PARSE_LPORT",
				element: {
					Class	: df_element3DS,
					options: {
						URL: "models/teleports/t01.3DS",
						animElementIndex: 1,
						material: {
							Class: df_UVAnimMaterial,
							options: {
								URL: "textures/tex01.png",
								transparent: 1
							}
						},
						Extends: {
							controller: {
								Class: df_tportLevelCtrl,
								options: {
									nearestScale  : 0.3,
									nextLevel     : true,
									activeEvent   : "GIGATOTAL",
									sounds: {
										nearest: {
											url: "sound/door/open01.mp3",
											volume: 0.8
										}
									}
								}
							}
						}
					}
				}
			}
		}		
		
		public static const list: Array = [
			//-----------------------------------------------------LEVEL 0, Cube---------------------------------------------				
/*			{
				id				: 7,
				name			: 'Куб',
				description		: 'Тестирование кораблей и монстров',
				netSupportIndex	: 0,
				Enviroment		: {
					url				: 'levels/07/ENV.3DS'
				},
				Explodes: defExplodes,
				Extends: [
					medicExtend
					//,MNSL02
					,ammoExtend2
				]
			},
			//-----------------------------------------------------LEVEL 1---------------------------------------------				
			{
				id				: 1,
				name			: 'Базовый',
				description		: 'Начальный уровень, проба моделирования сцен для игры, отрисовки текстур в 3D MAX',
				netSupportIndex	: 0,
				Enviroment		: {
					url				: 'models/level0.3DS',
					orientation		: [-90, 0, 0]
				},
				Explodes: defExplodes,
				Extends: [
					doorsGenerator
					,monsterExtend
				]
			},*/
			//-----------------------------------------------------LEVEL 2---------------------------------------------				
			{
				id				: 1,
				name			: 'Астероид',
				description		: 'Освещеность различными цветами, возможность вылета за пределы сцены, в космос',
				netSupportIndex	: 0,
				Enviroment		: {
					url				: 'levels/01/ENV.3DS'
				},
				Explodes: defExplodes,
				Extends: [
					medicExtend
					,doorsGenerator
					,monsterExtend
					,tportExtendLevel
					,{
						Class	: df_bgSpace,
						options	: {
							back: [
								{url: 'sky/sky01.png', scale: 1}
							]
						}
					}
				]
			},
//-----------------------------------------------------LEVEL 3---------------------------------------------				
			{
				id				: 2,
				name			: 'Блок-пост',
				description		: 'Четыре комнаты соединенные между собой переходами, отсутствие низа.',
				netSupportIndex	: 0,
				Enviroment		: {
					url				: 'levels/02/ENV.3DS',
					sound			: {
						url		: 'sound/env/abduction.mp3',
						loops	: 10,
						volume	: 0.3
					}
				},
				Explodes: defExplodes,
				Extends: [
					medicExtend
					,ammoExtend3
					,ammoExtend2
					,monsterExtend
					,monsterExtend2
					,tportExtendLevel
					
				]
			},
//-----------------------------------------------------LEVEL 4---------------------------------------------				
			{
				id				: 3,
				name			: 'Сумашествие',
				description		: 'Торроид, полное 3Д пространство! Ищите медикаменты в прямоугольной комнате.',
				netSupportIndex	: 0,
				Enviroment		: {
					url				: 'levels/03/ENV.3DS',
					sound			: {
						url		: 'sound/env/env04.mp3',
						loops	: 10,
						volume	: 0.3
					}
				},
				Explodes: defExplodes,
				Extends: [
					medicExtend
					,ammoExtend3
					,monsterExtend
					,monsterExtend2
					,lports
				]
			}
//-----------------------------------------------------LEVEL 4---------------------------------------------
/*			
			{
				id			: 5,
				name		: 'Деревня ON LINE',
				description	: '',
				netSupportIndex	: 0,
				Enviroment	: {
					url				: 'levels/05/ENV.3DS',
					background		: 0x333333,
					fog				: {
						color	: 0x333333,
						far		: 1000,
						near	: 500
					},
					sound			: {
						url		: 'sound/env/env04.mp3',
						loops	: 10,
						volume	: 0.3
					}
				},
				Explodes: defExplodes,
				Extends: [
					{
						Class: df_netSupport,
						options: {
							socket: {
								host	: df_servers.HOST,
								port	: df_servers.GAMEPORT,
								session	: 10005,
								uid		: Math.round(Math.random() * 100)
							},
							defaultChip: 2
						}
					}
				]
			}
*/			
		]
	}
}